﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Core.Extensions;
using Digitalmes.Model.PackageManagement;
using Digitalmes.Model;



namespace Digitalmes.ViewModel.PackageManagement.PackageRecordVMs
{
    public partial class PackageRecordPackageDetailListVM2 : BasePagedListVM<PackageRecord, PackageRecordDetailSearcher2>
    {
        
        protected override List<GridAction> InitGridAction()
        {
            return new List<GridAction>
            {
            };
        }
 
        protected override IEnumerable<IGridColumn<PackageRecord>> InitGridHeader()
        {
            return new List<GridColumn<PackageRecord>>{
                
                this.MakeGridHeader(x => x.PartSn).SetEditType(EditTypeEnum.TextBox).SetTitle(@Localizer["Page.产品条码"].Value),
                this.MakeGridHeader(x => x.StartTime).SetEditType(EditTypeEnum.Datetime).SetTitle(@Localizer["Page.首次装箱时间"].Value),
                this.MakeGridHeader(x => x.Remark).SetEditType(EditTypeEnum.TextBox).SetTitle(@Localizer["_Admin.Remark"].Value),

            };
        }

        
        public override IOrderedQueryable<PackageRecord> GetSearchQuery()
        {
                
            var id = (long?)Searcher.PackageId.ConvertValue(typeof(long?));
            if (id == null)
                return new List<PackageRecord>().AsQueryable().OrderBy(x => x.ID);
            var query = DC.Set<PackageRecord>()
                .Where(x => id == x.PackageId)

                .OrderBy(x => x.ID);
            return query;
        }

    }

    public partial class PackageRecordDetailSearcher2 : BaseSearcher
    {
        
        [Display(Name = "_Model._PackageRecord._Package")]
        public string PackageId { get; set; }
    }

}

